<!DOCTYPE html>
<html>
<head>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
</head>
<body>
<form method="get">
<select>
<option name="n">1</option>
<option name="y" selected>2</option>
<option id="o1" name="y">3</option>
<option id="o2" name="n">4</option>
</select>
</form>
<script>
test(function() {
  document.getElementById("o1").defaultSelected = true;
  document.getElementById("o2").selected = true;
  u = document.getElementsByName("n");
  for (i = 0; i < u.length; i++)
    assert_false(u[i].matches(":default"));
  v = document.getElementsByName("y");
  for (i = 0; i < v.length; i++)
    assert_true(v[i].matches(":default"));
}, "This test performs a check for option elements having selected attribute to be considered for :default CSS selector.");
</script>
</body>
</html>